#ifndef PIO_H
#define PIO_H

#include "stm32f10x.h"
//#include "stm32f10x_gpio.h"

#define PIO_PERIPH_OUTPUT           0
#define PIO_PERIPH_INPUT            1
#define PIO_INPUT                   2
/// The pin is an output and has a default level of 0.
#define PIO_OUTPUT_0                3
/// The pin is an output and has a default level of 1.
#define PIO_OUTPUT_1                4

#define PIO_OUTPUT_PUSH_PULL        0
#define PIO_OUTPUT_OPEN_DRAIN       1
//#define PIO_DEFAULT					2

#define PIO_INPUT_FLOATING			1
#define PIO_INPUT_PULLUP			2

#define PIO_OUTPUT_SPEED_2			0
#define PIO_OUTPUT_SPEED_10			1
#define PIO_OUTPUT_SPEED_50			2

#define STM_PIO_BIT3		12
#define STM_PIO_BIT6		24
#define STM_PIO_BIT7		28
#define STM_PIO_BIT8		0
#define STM_PIO_BIT9		4
#define STM_PIO_BIT10		8

#define STM_PIO_BIT13       20
#define STM_PIO_BIT14       24
#define STM_PIO_BIT15       28

#define STM_PIN_ID_0		0
#define STM_PIN_ID_1		1
#define STM_PIN_ID_2		2
#define STM_PIN_ID_3		3
#define STM_PIN_ID_4		4
#define STM_PIN_ID_5		5
#define STM_PIN_ID_6		6
#define STM_PIN_ID_7		7
#define STM_PIN_ID_8		8
#define STM_PIN_ID_9		9
#define STM_PIN_ID_10		10
#define STM_PIN_ID_11		11
#define STM_PIN_ID_12		12
#define STM_PIN_ID_13		13
#define STM_PIN_ID_14       14
#define STM_PIN_ID_15       15

typedef struct
{
	unsigned int bit_num;
	GPIO_TypeDef* pio;
	unsigned char id;
    unsigned char type;
    unsigned char attribute;
    unsigned char speed;
} Pin;

#define PIO_LISTSIZE(pPins)    (sizeof(pPins) / sizeof(Pin))

#endif //#ifndef PIO_H

